home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / src.lha / src / amitcp / netinet / tcp_seq.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  3.0 KB  |  83 lines

  1. /*
  2.  * $Id: tcp_seq.h,v 1.2 1993/03/03 21:10:59 jraja Exp $
  3.  *
  4.  * HISTORY
  5.  * $Log: tcp_seq.h,v $
  6.  * Revision 1.2  1993/03/03  21:10:59  jraja
  7.  * Added #ifdef to prevent multiple inclusion.
  8.  * moved 'tcp_iss' definition to tcp_usrreq.c.
  9.  *
  10.  * Revision 1.1  92/11/17  16:30:44  16:30:44  jraja (Jarno Tapio Rajahalme)
  11.  * Initial revision
  12.  * 
  13.  *
  14.  */
  15.  
  16. /*
  17.  * Copyright (c) 1982, 1986 Regents of the University of California.
  18.  * All rights reserved.
  19.  *
  20.  * Redistribution and use in source and binary forms, with or without
  21.  * modification, are permitted provided that the following conditions
  22.  * are met:
  23.  * 1. Redistributions of source code must retain the above copyright
  24.  *    notice, this list of conditions and the following disclaimer.
  25.  * 2. Redistributions in binary form must reproduce the above copyright
  26.  *    notice, this list of conditions and the following disclaimer in the
  27.  *    documentation and/or other materials provided with the distribution.
  28.  * 3. All advertising materials mentioning features or use of this software
  29.  *    must display the following acknowledgement:
  30.  *    This product includes software developed by the University of
  31.  *    California, Berkeley and its contributors.
  32.  * 4. Neither the name of the University nor the names of its contributors
  33.  *    may be used to endorse or promote products derived from this software
  34.  *    without specific prior written permission.
  35.  *
  36.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  37.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  39.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  40.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  41.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  42.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  43.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  44.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  45.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  *
  48.  *    @(#)tcp_seq.h    7.4 (Berkeley) 6/28/90
  49.  */
  50.  
  51. #ifndef TCP_SEQ_H
  52. #define TCP_SEQ_H
  53.  
  54. /*
  55.  * TCP sequence numbers are 32 bit integers operated
  56.  * on with modular arithmetic.  These macros can be
  57.  * used to compare such integers.
  58.  */
  59. #define    SEQ_LT(a,b)    ((int)((a)-(b)) < 0)
  60. #define    SEQ_LEQ(a,b)    ((int)((a)-(b)) <= 0)
  61. #define    SEQ_GT(a,b)    ((int)((a)-(b)) > 0)
  62. #define    SEQ_GEQ(a,b)    ((int)((a)-(b)) >= 0)
  63.  
  64. /*
  65.  * Macros to initialize tcp sequence numbers for
  66.  * send and receive from initial send and receive
  67.  * sequence numbers.
  68.  */
  69. #define    tcp_rcvseqinit(tp) \
  70.     (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
  71.  
  72. #define    tcp_sendseqinit(tp) \
  73.     (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
  74.         (tp)->iss
  75.  
  76. #define    TCP_ISSINCR    (125*1024)    /* increment for tcp_iss each second */
  77.  
  78. #ifdef KERNEL
  79. extern tcp_seq    tcp_iss;        /* tcp initial send seq # */
  80. #endif
  81.  
  82. #endif /* !TCP_SEQ_H */
  83.